package org.jeecg.modules.engineering.mapper;

import java.util.Date;
import java.util.List;

import com.baomidou.mybatisplus.annotation.SqlParser;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.engineering.entity.EquipCollectInfo;
import org.jeecg.modules.engineering.entity.EquipEventInfo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.engineering.vo.EquipEventInfoSum;
import org.jeecg.modules.engineering.vo.EquipEventInfoExt;
import org.jeecg.modules.engineering.vo.EventProcessStatus;
import org.springframework.stereotype.Repository;

/**
 * @Description: 设备事件信息表
 * @Author: jeecg-boot
 * @Date:   2019-08-20
 * @Version: V1.0
 */
@Repository
public interface EquipEventInfoMapper extends BaseMapper<EquipEventInfo> {

    @SqlParser(filter = true)
    void insertBatch(@Param("eventInfos")List<EquipEventInfo> eventInfos);

    List<EquipEventInfoExt> findEventInfoByProject(@Param("projectId") String projectId, @Param("minLevel") Integer minLevel, @Param("maxLevel") Integer maxLevel);

    List<EquipEventInfoSum> findEventInfoSumByProject(@Param("projectId")String projectId, @Param("levelList") List<String> levelList, @Param("startTime") Date startTime);

    /**
     * 获取消防系统里 每个事件分类下的未处理事件合计数
     * @param projectId
     * @param topSystem
     * @return
     */
    List<EventProcessStatus> findUnProcessByProjectAndSystem(@Param("projectId") String projectId,@Param("topSystem") String topSystem);

    @SqlParser(filter = true)
    @Select("SELECT sort_name FROM equip_event_sort WHERE id = #{eventId}")
    String selectNameById(@Param("eventId") String eventId);

    List<EquipEventInfo> selectSqlList(Page<EquipEventInfo> page, String eventId, String equipName, @Param("ids")List<String> projectIds);

    List<EquipEventInfo> selectSqlList(String eventId, String equipName, @Param("ids")List<String> projectIds);
}
